﻿using System;
using System.Runtime.Serialization;

namespace JXT.PrimaryKey.Batman.Core.Security
{
    /// <summary>
    /// 用户安全cookie信息
    /// </summary>
    [DataContract]
    public class SecurityCookie
    {
        /// <summary>
        /// 随机guid，防止cookie爆破
        /// </summary>
        [DataMember]
        public Guid Guid { get; set; }
        
        /// <summary>
        /// 用户Id
        /// </summary>
        [DataMember]
        public int Id { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [DataMember]
        public string Name { get; set; }

        /// <summary>
        /// 用户邮件
        /// </summary>
        [DataMember]
        public string Mail { get; set; }

        /// <summary>
        /// 默认的cookie信息
        /// </summary>
        public static SecurityCookie Default
        {
            get
            {
                return new SecurityCookie()
                {
                    Guid = Guid.Empty,
                    Id = -1,
                    Name = String.Empty,
                    Mail = String.Empty
                };
            }
        }
    }
}
